package org.sunflower.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.sunflower.domian.dto.UserDto;
import org.sunflower.feign.UserFeignClient;

import java.util.List;

/**
 * @description:
 * @author: TanJingyu
 * @create: 2021-09-29 16:14
 **/
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserFeignClient client;

    @GetMapping
    public List<UserDto> list() {
        UserDto userDto = new UserDto();
        userDto.setId(1L);
        userDto.setPassword("2324234");
        userDto.setPhone("343434");
        userDto.setUsername("名字");
//        return client.list(userDto);
        return client.list("{}");
    }

    @GetMapping("/post")
    public Object testPost() {
        return client.addUser();
    }
}
